-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(envvars): added industry standard dotenv parsing regex for adding envvars in settings #2327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… envvars in settings
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryEnhanced dotenv parsing to support industry-standard Key improvements:
Remaining concern:
Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant Component as EnvironmentVariables
participant Parser as parseEnvVarLine
participant API as Save/Upsert Mutations
User->>Component: Paste env vars (Ctrl+V)
Component->>Component: handlePaste(e, index)
Component->>Component: Split by newline
loop For each line
Component->>Parser: parseEnvVarLine(line)
Parser->>Parser: Trim whitespace
alt Line is comment or empty
Parser-->>Component: return null
else Line contains export
Parser->>Parser: Remove "export " prefix
end
Parser->>Parser: Find '=' index
Parser->>Parser: Extract key before '='
Parser->>Parser: Validate key with ENV_VAR_PATTERN
alt Key invalid
Parser-->>Component: return null
end
Parser->>Parser: Extract value after '='
alt Looks like base64 + padding only + length > 20
Parser-->>Component: return null (reject split base64)
end
alt Value not quoted
Parser->>Parser: Remove inline comments (\s#)
end
Parser->>Parser: Strip quotes if present
Parser-->>Component: return {key, value, id}
end
Component->>Component: Filter valid entries
Component->>Component: Update envVars state
User->>Component: Click Save
Component->>API: savePersonalMutation.mutateAsync()
Component->>API: upsertWorkspaceMutation.mutateAsync()
API-->>Component: Success
Component->>Component: Update initial refs
Component-->>User: Changes saved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 1 comment
...aceId]/w/components/sidebar/components/settings-modal/components/environment/environment.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 2 comments
...aceId]/w/components/sidebar/components/settings-modal/components/environment/environment.tsx
Show resolved
Hide resolved
...aceId]/w/components/sidebar/components/settings-modal/components/environment/environment.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 1 comment
Summary
Type of Change
Testing
Tested manually
Checklist